# $Id: PKGBUILD 184152 2013-05-02 20:47:10Z eric $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgbase=quodlibet
pkgname=('quodlibet' 'quodlibet-plugins')
pkgver=2.5.1
_pkgver=2.5.1
pkgrel=1
arch=('any')
license=('GPL2')
url="http://code.google.com/p/quodlibet/"
makedepends=('intltool' 'python2-gobject2' 'gtk-update-icon-cache'
             'hicolor-icon-theme' 'desktop-file-utils')
options=('!makeflags')
source=(https://quodlibet.googlecode.com/files/$pkgbase-$_pkgver.tar.gz
        https://quodlibet.googlecode.com/files/$pkgbase-plugins-$_pkgver.tar.gz)
sha1sums=('3897109ca47a0d59dc3c18a176b10feeccc21afe'
          'e23206be3322a9b79cd0a70448fafeeb0e02a58a')

build() {
  cd "${srcdir}/${pkgbase}-${_pkgver}"
  sed -i 's/env python/env python2/' exfalso.py quodlibet.py \
    ../${pkgbase}-plugins-${_pkgver}/songsmenu/replaygain.py
  python2 setup.py build
}

package_quodlibet() {
  pkgdesc="An audio library tagger, manager and player"
  depends=('gstreamer0.10-python' 'gstreamer0.10-base-plugins' 'gstreamer0.10-good-plugins'
           'gstreamer0.10-ugly-plugins' 'mutagen' 'pygtk' 'hicolor-icon-theme' 'desktop-file-utils')
  optdepends=('gstreamer0.10-ffmpeg: for ffmpeg (ASF/WMA) support'
              'gstreamer0.10-bad-plugins: for MPEG-4 (AAC) and Musepack support'
              'python2-dbus: for dbus support'
              'notification-daemon: for notification support'
              'libgpod: for ipod support'
              'python2-feedparser: for audio feeds (podcast) support'
              'python2-keybinder2: for the multimedia keys support'
              'udisks: for media devices support'
              'media-player-info: for media devices support')
  install=quodlibet.install

  cd "${srcdir}/${pkgbase}-${_pkgver}"
  python2 setup.py install --prefix="${pkgdir}/usr"
}

package_quodlibet-plugins() {
  pkgdesc="Various plugins for QuodLibet"
  depends=('quodlibet')
  optdepends=('python2-gnomevfs: for "Automatic Masking" plugin'
              'python2-dbus: for "Gajim Status Message" plugin'
              'cddb-py: for "CDDB Lookup" plugin'
              'python2-musicbrainz2: for "MusicBrainz Lookup" plugin'
              'python2-pyinotify: for "Automatic library update" plugin'
	      'kakasi: for "Kana/Kanji Simple Inverter" plugin'
	      'zeitgeist: for "Event Logging" plugin'
              'gstreamer0.10-bad-plugins: for "Audio Pitch/Speed" plugin')

  cd "${srcdir}/${pkgbase}-plugins-${_pkgver}"
  install -d "${pkgdir}/usr/lib/python2.7/site-packages/quodlibet/plugins"
  cp -r editing events gstreamer playorder songsmenu "${pkgdir}/usr/lib/python2.7/site-packages/quodlibet/plugins"
}
